﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using DataUpload;

namespace Logistics.Utils
{
    class NetworkRequirementForm
    {
        public static bool prompt(String msg)
        {
            MessageBoxResult dialogResult = MessageBoxResult.OK;
            while (!NetworkUtils.IsNetworkConnected() && dialogResult == MessageBoxResult.OK)
            {
                dialogResult = MessageBox.Show("以下操作需要连接网络!请先连接网络，然后选择确定，退出请选择取消！\n"+msg, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
            }
            if (dialogResult == MessageBoxResult.Cancel)
            {
                //当前无法联网，用户选择了取消
                return false;
            }
            return true;
        } 
    }
}
